Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jb-calendar

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jb-calendar

jalali calendar interface web component

  • 1.3.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

jb-calendar

pure js jalali calendar interface web component sample: https://codepen.io/javadbat/pen/poRKYEY

  • support jalali date as well as gregorian date
  • customizable theme with css variable so you can implement dark mode too

installation

npm install jb-calendar

usage

    <jb-calendar></jb-calendar>

in frameworks for example React:

import 'jb-calendar'
function myHOC(){
    return(
        <jb-calendar></jb-calendar>   
    )
}

select value

    document.querySelector('jb-calendar').select(year,month,day);
    // for example:
    document.querySelector('jb-calendar').select(1399,8,24);

you can write wrapper for it in any js framework you use and it will compatible with react, vue, angular, ...

dependancy

we use dayjs to manege calendar jalali data

events

//when defualt property are defined best time for impl your config like min and max date
document.querySelector('jb-calendar').addEventListener('init',this.onCalendarElementInitiated);

//when calendar init all property and function and dom created and bind successully
document.querySelector('jb-calendar').addEventListener('load',this.onCalendarElementLoaded);

//when user select a selectable day on calendar
document.querySelector('jb-calendar').addEventListener('select',this.onDaySelected);

Jalali and Gregorian Date input

in jb-calendar you can set date input type to be jalali or gregorian and change it whenever you want by simple set dateInput to JALALI or GREGORIAN.

    document.querySelector('jb-calendar').dateInput = `GREGORIAN`;

attribute

other attribute

atribute namedescription
directionset web-component direction for legacy browser dont support :dir(). defualt set is rtl but if you need ltr use <jb-input direction="ltr"></jb-input>

set custome style

in some cases in your project you need to change defualt style of web-component for example you need different color or different border-radius and etc.
if you want to set a custom style to this web-component all you need is to set css variable in parent scope of web-component

css variable namedescription
--jb-calendar-colorgeneral text color of component
--jb-calendar-arrow-button-bgcolorbackground color of next and prev button
--jb-calendar-day-text-colorday text color
--jb-calendar-day-text-color-disabledday text color when day in not available for select
--jb-calendar-day-text-color-todaytoday day text color
--jb-calendar-day-bgcolor-selectedselected day background color
--jb-calendar-day-bgcolor-selected-hoverselected day background color on hover
--jb-calendar-day-bgcolor-hoverday background color on hover
--jb-calendar-status-point-bgcolor-todaybackgrround color of small cirle under today text
--jb-calendar-status-point-border-colorborder color of status point
--jb-calendar-month-bgcolor-hoverbackground color of month in month list in hover state
--jb-calendar-year-bgcolor-hoverbackground color of year in month list in hover state
--jb-calendar-arrow-fill-colornext and prev arrow icon color

Keywords

FAQs

Package last updated on 13 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc